package com.atguigu.admin.service.impl;

import com.atguigu.admin.service.ProductService;
import com.atguigu.clients.ProductClient;
import com.atguigu.clients.SearchClient;
import com.atguigu.param.ProductSaveParam;
import com.atguigu.param.ProductSearchParam;
import com.atguigu.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName:ProductServiceImpl
 * Package:com.atguigu.admin.service.impl
 * Description:
 *
 * @Author 应永豪
 * @Create 2024/4/23 15:26
 * @Version 1.0
 */
@Service
@Slf4j
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductClient productClient;
    @Autowired
    private SearchClient searchClient;
    @Override
    public R search(ProductSearchParam param) {
        R search = searchClient.search(param);
        log.info("ProductServiceImpl.search业务执行结束，结果为：{}",search);
        return search;
    }

    @Override
    public R save(ProductSaveParam param) {
        R r = productClient.adminSave(param);
        log.info("ProductServiceImpl.save业务执行结束，结果为：{}",r);
        return r;
    }
}
